package com.guxingke.nioserver.test;

import com.guxingke.nioserver.core.Notifier;
import com.guxingke.nioserver.core.Server;
import com.guxingke.nioserver.dispathcher.RestDispatcher;

/**
 * Created by guxingke on 15-8-18.
 */
public class Bootstrap {
    public static void main(String[] args) {
        RestDispatcher dispather = new RestDispatcher();
        Notifier notifier = Notifier.getNotifier();
        notifier.addListener(new LogEvent());
        notifier.addListener(dispather);

        dispather.addMapping("test", TestHandler.class);

        Server server = null;
        try {
            server = new Server(20000);
        } catch (Exception e) {
            e.printStackTrace();
        }

        server.setNotifier(notifier);
        Thread tServer = new Thread(server);
        tServer.start();
    }
}
